<template>
  <div>
    <button @click="isShow = !isShow">显示/隐藏</button>
    <!-- <h1 v-show="isShow" class="go">你好，我是阿占</h1> -->
    <transition name="hello" appear>
      <!-- 
        name
            需要在下方调用动画时修改v为name
        省略
            :appear="true"
            appear
                加载页面时出现动画
        transition不是元素，解析模板后变没
       -->
      <h1 v-show="isShow">你好，我是阿占</h1>
    </transition>
  </div>
</template>

<script>
export default {
  name: "TestVue",
  data() {
    return {
      isShow: true,
    };
  },
};
</script>

<style scoped>
h1 {
  background-color: #bfa;
}
/* 进入 */
.hello-enter-active {
  animation: azhan .5s linear;
}
/* 离开 */
.hello-leave-active {
  animation: azhan .5s linear reverse;
}
@keyframes azhan {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0px);
  }
}
</style>